package com.freemyleft.left.left_app.mian.index.message.adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.freemyleft.left.left_app.R;
import com.freemyleft.left.left_app.mian.index.my.MyRanking.adapter.MyRankingAdapter;
import com.freemyleft.left.zapp.ui.recycler.MultipleItemEntity;
import com.freemyleft.left.zapp.ui.recycler.MultipleRecyclerAdapter;
import com.freemyleft.left.zapp.ui.recycler.MultipleViewHolder;

import java.util.List;

public class MessageAdapter extends MultipleRecyclerAdapter{
    public final static int  MESSAGE_TYPE=113;

    public MessageAdapter(List<MultipleItemEntity> data) {
        super(data);
        addItemType(MESSAGE_TYPE, R.layout.item_message);
    }

    @Override
    protected void convert(MultipleViewHolder holder, MultipleItemEntity entity) {
        super.convert(holder, entity);
        String photo = entity.getField(MessageFlies.PHOTO);
        String name = entity.getField(MessageFlies.NAME);
        String message = entity.getField(MessageFlies.MESSAGE);
        String date=entity.getField(MessageFlies.DATE);
        holder.setText(R.id.tv_student_name, name);
        holder.setText(R.id.message_body, message);
        holder.setText(R.id.tv_date, date);
        Glide.with(mContext).load(photo).into((ImageView) holder.getView(R.id.student_photo));
    }
    public enum MessageFlies{
        PHOTO,
        NAME,
        MESSAGE,
        DATE,
    }
}
